import {
    Toast
  } from "vant";
  import cTitle from "components/title";
  import {
    scrollMixin
  } from "../../../utils/mixin";
  export default {
    mixins: [scrollMixin], //加载更多
    data() {
      return {
        list: [],
        isLoadMore: true,
        page: 1,
        total_page: 0,
      };
    },
  
    components: {
      cTitle
    },
    activated() {
      console.log('active')
      if (!localStorage.getItem("uid")) {
        this.$router.push(this.fun.getUrl("login"));
        return
      }
      this.getList();
    },
    computed: {
  
    },
    methods: {
        toDetail(item){
            console.log(item,'查看')
            if(item.status == 1 || item.status == 2){
              this.$router.push(this.fun.getUrl("nnMoneyTransferDetail",item));
            }else {
              this.$router.push(this.fun.getUrl("nnMoneyTransfer"));
            }
            
        },
        changeTabs(index){
            this.currentTabs = index;
            this.page =  1;
            this.list = [];
            this.getList();
        },
      openPicker() {
        this.pickerShow = true;
      },
      getList() {
        $http.get("NiuTwo.huikuan_log", {
          uid: localStorage.getItem("uid")
        }, "加载中").then((res) => {
          if (res.result == 1) {
            console.log(res, 'shuju_list')
            this.list = res.data;
            // var nextPageData = res.data.list.data;
            // this.list = [...this.list, ...nextPageData];
            // this.total_page = res.data.list.last_page;
            // this.isLoadMore = true;
          } else {
            this.isLoadMore = false;
          }
        });
      },
      getMoreData() {
        if (!this.isLoadMore) return;
        this.isLoadMore = false; // 防止多次请求分页数据
        if (this.page >= this.total_page) {
          Toast('到底了')
          return;
        } else {
          this.page += 1;
          this.getList();
        }
      },
      
    }
  };